# 练习题：
# 1、已知一个数字列表，打印列表中所有的奇数
# list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
# list2 = []
# for i in list1:
#     if i % 2 == 1:
#         list2.append(i)
# print(list2)

# 2、已知一个数字列表，打印列表中所有能被能被3整除但是不能被2整除的数
# list1 = [1,2,3,4,5,6,7,8,9]
# list2 = []
# for i in list1:
#     if i%3 == 0 and i%2 == 1:
#         list2.append(i)
# print(list2)

# 3、已知一个数字列表，计算所有偶数的和
# list1 = [1,2,3,4,5,6,7,8,9]
# list2 = []
# for i in list1:
#     if i%2 == 0:
#         list2.append(i)
# print(sum(list2))

# 4、已知一个列表，获取列表中下标为奇数是所有元素(从0开始的下标值)
# list1 = [1,2,3,4,5,6,7,8,9]
# list2 = list1[1::2]
# print(list2)

# 5、已知一个数字列表，将列表中所有元素乘以2
# list1 = [1,2,3,4,5,6,7,8,9]
# list2 = []
# for i in list1:
#     list2.append(i*2)
# print(list2)

# 6、定义一个列表保存多个学生的分数，删除列表中所以低于60分的值
# list1 = [60,80,152,45,78,68,12,50,60,23,28,10,74,89,124,354]
# for i in list1[:]:
#     if i < 60:
#         list1.remove(i)
# print(list1)

# 7、已知一个列表保存了多个学生的姓名，要求去掉列表中重复的名字
# list1 = ['张三','王五','李四','赵二','王五','李四','赵二','王五']
# list2 = []
# for name1 in list1:
#     if name1 not in list2:
#         list2.append(name1)
# print(list2)

# 8、已知一个数字列表，获取列表中值最大的元素 （不能使用max函数）
# list1 = [60,80,152,45,78,68,12,50,60,23,28,10,74,89,124,354]
# num1 = list1[0]
# for i in list1:
#     if i > num1:
#         num1 = i
# print(i)

# 9、已知两个有序列表(列表中的元素已经按照从小到大的方式排好序)，要求合并两个列表，合并后元素还是从小到大排序
# 例如： list1 = [10, 23, 45, 67, 91] 输入: 50 -> list1 = [10, 23, 45, 50, 67, 91]
# list1 = [8,11,20,50,88,90]
# list2 = [6,15,25,60,78,102]
# list3 = sorted(list1+list2,reverse = False)
# print(list3)

# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# 10、请循环遍历出所有的key
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# for i in dict.keys():
#     print(i)

# 11、请循环遍历出所有的value
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# for i in dict.values():
#     print(i)

# 12、请循环遍历出所有的key和value
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# for i in dict.items():
#     print(i)

# 13、请在字典中增加一个键值对, "k4": "v4"，输出添加后的字典
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# dict ["k4"] = "v4"
# print(dict)

# 14、请删除字典中键值对 "k1": "v1", 并输出删除后的结果
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# del dict["k1"]
# print(dict)

# 15、请删除字典中键"k5"对应的键值对，如果字典中不存在键"k5", 则不报错，返回None
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# for i in dict:
#     if i == "k5":
#         del dict["k5"]
#     if "k5" not in dict:
#         print(None)

# 16、请获取字典中"k2"对应的值
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# print(dict.get("k2"))

# 17、请获取字典中"k6"对应的值, 如果不存在，则不报错，并且让其返回None。
# dict = {"k1": "v1", "k2": "v2", "k3": "v3"}
# for i in dict:
#     if i == "k6":
#         print(dict.get("k6"))
#     if "k6" not in dict:
#         print(None)

# 18、现有dict2 = {"k1": "v11", "a": "b"}, 通过一行操作使dict2 = {"k1": "v1", "k2": "v2", "k3": "v3", "a": "b"}
# dict2 = {"k1": "v11", "a": "b"}
# dict2.update({"k1": "v1", "k2": "v2", "k3": "v3", "a": "b"})
# print(dict2)

# 19、定义一个电话簿，里头设置以下联系人：
# {'mayun':'13309283335',
# 'zhaolong':'18989227822',
# 'zhangmin':'13382398921',
# 'Gorge':'19833824743',
# 'Jordan':'18807317878',
# 'Curry':'15093488129',
# 'Wade':'19282937665'}
# 现在输入人名，查询他的号码。
# 【输入形式】
#
# 人名，是一个字符串。
# 【输出形式】
#
# 电话号码。如果该人不存在，返回"not found"
# 【样例输入】
#
# mayun
# 【样例输出】

# dict1 = {'mayun':'13309283335',
# 'zhaolong':'18989227822',
# 'zhangmin':'13382398921',
# 'Gorge':'19833824743',
# 'Jordan':'18807317878',
# 'Curry':'15093488129',
# 'Wade':'19282937665'}
# name1 = input("请输入要查询的名字")
# if name1 in dict1:
#     value = dict1[name1]
#     print(f"查询 {name1}的号码是{value}")
# else:
#     print("not found")

dict1 = {'mayun':'13309283335',
'zhaolong':'18989227822',
'zhangmin':'13382398921',
'Gorge':'19833824743',
'Jordan':'18807317878',
'Curry':'15093488129',
'Wade':'19282937665'}
name1 = input("请输入要查询的名字")
if name1 in dict1:
    value = dict1[name1]
    print(f"查询 {name1}的号码是{value}")
else:
    print("not found")
>>>>>>> 073254b285072526436f44c5c9343558f301e0df
#查询 mayun的号码是13309283335